<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/base/jsp/include.jsp"%>
<style>

</style>
<script type="text/javascript">
    var id = "${id}";
    var submitForm = function($dialog, $grid, $pjq) {
        if ($('form').form('validate')) {
            var obj=sy.serializeObject($('form'));
            obj.isAgree = 0;
            obj.domainId = $('#domainId').combobox('getValue');
            var number = $("#phone").val();
            if(!/^[0-9]+$/.test(number)){
                $.messager.alert('Warning','联系方式请输入数字!');
                return;
            }
            obj.teamworkWayId = $('#teamworkWayId').combobox('getValue');
            var url=sy.contextPath + '/technologymessage/myListSave.do';
            $.post(url, obj, function(result) {
                if (result.code == 0) {
                    $grid.datagrid('reload');
                    $dialog.dialog('destroy');
                } else {
                    $pjq.messager.e('添加失败,'+result.msg);
                }
            }, 'json');
        }
    };
    
    $(function() {
        $('#domainId').combobox({              
                url:sy.contextPath + '/trade/myList.do',
                valueField:'tradeId',
                textField:'tradeName',   
        });
    }); 
    
    $(function() {
        $('#teamworkWayId').combobox({              
                url:sy.contextPath + '/teamWorkWay/myList.do',
                valueField:'id',
                textField:'name',   
        });
    });
    $(function() {
        if (id != '') {
            parent.$.messager.progress({
                text : '数据加载中....'
            });
            $.post(sy.contextPath + '/technologymessage/findById.do', {
                id : id
            }, function(result) {
                if (result) {
                    $('form').form('load', result);
                    $('#file_upload').setFileId(result.image,true,true);
                }
                parent.$.messager.progress('close');
            }, 'json');
        }
        
        
    });
</script>
</head>
<body>
    <form id="form" method="post">
        <input name="id" type="hidden" />
        <input name="fid" type="hidden" />
        <div style="padding:15px;font-size: 12px">
            <table style="table-layout:fixed;" border="0" cellspacing="0" class="formtable">
                <tr>
                    <th style="width:100px;">技术名称：</th>
                    <td>
                        <input class="easyui-textbox" id = "technologyName" name = "technologyName"  data-options="required:true,validType:'length[1,50]'" style="width:100%"/>
                    </td>
                    <th style="width:100px;">行业领域：</th>
                    <td>
                        <input class="easyui-combobox" id = "domainId" name = "domainId"  data-options="required:true,editable:false" style="width:100%"/>
                    </td>
                                
                </tr>   
                <tr>   
                    <th style="width:100px;">合作方式：</th>
                    <td>
                        <input class="easyui-combobox" id = "teamworkWayId" name = "teamworkWayId"  data-options="required:true,editable:false" style="width:100%"/>
                    </td>
                    <th style="width:100px;">是否有专利：</th>
                    <td>
                        <select class="easyui-combobox" id = "havezl" name = "havezl"  data-options="required:true,editable:false" style="width:100%">
                            <option value="1">有</option>
                            <option value="0">否</option>
                        </select>
                    </td>
                </tr>
                <tr>                   
                    <th style="width:100px;">所属高校/科研院所：</th>
                    <td colspan="3">
                        <input class="easyui-textbox" id = "area" name = "area"  data-options="required:true,validType:'length[1,50]'" style="width:100%"/>
                    </td>
                     <th style="width:100px;">联系电话：</th>
                    <td>
                        <input class="easyui-textbox" id = "phone" name = "phone"  data-options="required:true,validType:'length[1,13]'" style="width:100%"/>
                    </td>
                </tr>
                <tr>                       
                    <th style="width:100px;">概况：</th>
                    <td colspan="3">
                        <textarea class="easyui-textbox" id = "content" name = "content"  data-options="required:true,validType:'length[1,1500]',multiline:true" style="width:100%;height: 100px"></textarea>
                    </td>
                </tr>                
            </table>
        </div>
    </form>
</body>
</html>